<?php
defined('_JEXEC') or die;

JHtml::_('behavior.keepalive');
$tpath	= JURI::base().'templates/'.JFactory::$application->getTemplate();
extract($this->data->information);//keys 2 variables
$user = JFactory::getUser();
?>
<script type="text/javascript">
function isValidEmail(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

	return pattern.test(emailAddress);
}

function check()
{
	var temp=0;
	if(jQuery("#fornave").val()==''){
			 jQuery("#fornave").attr('style','border:1px solid red');
			temp=1;
	}
	else
		jQuery("#fornave").attr('style','solid 1px #C5C5C5');


	if(jQuery("#efternavn").val()=='')
	{
			 jQuery("#efternavn").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#efternavn").attr('style','solid 1px #C5C5C5');


	if(jQuery("#alder").val()=='')
	{
			 jQuery("#alder").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#alder").attr('style','solid 1px #C5C5C5');


	if(jQuery("#hojde").val()=='')
	{
			 jQuery("#hojde").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#hojde").attr('style','solid 1px #C5C5C5');


	if(jQuery("#vagt").val()=='')
	{
			 jQuery("#vagt").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#vagt").attr('style','solid 1px #C5C5C5');


	if(jQuery("#mobile").val()=='')
	{
			 jQuery("#mobile").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#mobile").attr('style','solid 1px #C5C5C5');

/*
	if(jQuery("#sky").val()=='')
	{
			 jQuery("#sky").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#sky").attr('style','solid 1px #C5C5C5');
*/

	if(!isValidEmail(jQuery("#email").val()))
	{
			 jQuery("#email").attr('style','border:1px solid red');
			 temp=1;
	}
	else
		jQuery("#email").attr('style','solid 1px #C5C5C5');

	if(temp==0)
		jQuery('#member-edit').submit();
}

</script>
<script type="text/javascript">
          jQuery(function(){ 

          $("#choicemaker").change(function() {
                var count= parseInt($(this).val());
                for(i=1;i<=4;i++)
                    $('#nam'+i+'').hide();  
                for(i=1;i<=count;i++)
                 $('#nam'+i+'').show(); 
            });
          $("#close_meeting").click(function() {
              $("#f-event3").hide();
            });
          
        });
</script>
<h2 class="titlepage">Personlige oplysninger</h2>
<h3 class="title-step-page">Personlige oplysninger</h3>  
<div class="eachBox creater-user-box clearfix">
    <form id="member-edit" action="" method="post" class="form-validate">
    <div class="cont-box">
        <div class="decs-p">
            <p>Alle felter markeret med *rød stjerne skal besvares – resten er valgfrie. Men vi opfordrer til at udfylde flest mulige felter, da det giver vejlederen mest mulig information inden jeres webmøde.</p>
            <p>Har du nogle spørgsmål eller andet undervejs, er du meget velkommen til at kontakt kundeservice her</p>
        </div>
        <div class="wrapCreaterUser"> 
            <div class="col-info-1">
                <div class="eachRow eachInput clearfix"> 
                    <p>Fornavn <span class="red">*</span></p>
                    <input class="txtip" type="text" name="jform[fornavn]" id="fornave" value="<?php echo str_replace(" ".$this->data->Efternavn,"",$this->data->name)?>">
                </div>
                <div class="eachRow eachInput clearfix"> 
                    <p>Efternavn  <span class="red">*</span></p>
                    <input class="txtip" type="text" name="jform[efternavn]" id="efternavn" value="<?php echo $this->data->Efternavn;?>">
                </div>
                <div class="eachRow clearfix"> 
                    <div class="eachInput divi-col divi-1-3 m-l-0">
                        <p>Alder <span class="red">*</span></p>
                        <input class="txtip" name="jform[Alder]" id="alder" value="<?php echo $this->data->Alder;?>"> 
                    </div>
                    <div class="eachInput divi-col divi-1-3">
                        <p>Højde  <span class="red">*</span></p>
                        <input class="txtip" name="jform[Højde]" id="hojde" value="<?php echo $this->data->Højde;?>"> 
                    </div> 
                    <div class="eachInput divi-col divi-1-3">
                        <p>Vægt  <span class="red">*</span></p>
                        <input class="txtip" name="jform[Vægt]" id="vagt" value="<?php echo $this->data->Vægt;?>"> 
                    </div>  
                </div>
                <div class="eachRow clearfix"> 
                    <div class="eachInput divi-col divi-2-3 m-l-0">
                        <p>Ønsker du vægttabeller muskelforøgelse?</p>
                        <select class="select-sl" name="jform[weekdown]" id="mangeuger">
                            <option value="1" <?php if($weekdown==1) echo "selected"?>>Vægttab</option>
                            <option value="2" <?php if($weekdown==2) echo "selected"?>>Muskelforøgelse</option>                
                        </select> 
                    </div>
                    <div class="eachInput divi-col divi-1-3">
                        <p>Hvor mange kg.?</p>
                        <input class="txtip" name="jform[weightdown]" id="duattabe" value="<?php echo $weightdown?>"> 
                    </div>  
                </div>
                <div class="eachRow eachInput clearfix"> 
                    <p>Mobiltelefon <span class="red">*</span></p>
                    <input class="txtip" name="jform[Mobiltelefon]" id="mobile" value="<?php echo $this->data->Mobiltelefon;?>">
                </div>
                <div class="eachRow eachInput clearfix">                              
                     <p>Skype id  <span class="tool-tip" id="my-tooltip"><img src="templates/fitplan/src_mobile/images/iconTooltip.png"></span></p> 
                    <input class="txtip" name="jform[skype]" id="sky" value="<?php echo $this->data->skype;?>">
                </div>
                <div class="eachRow eachInput clearfix"> 
                    <p>E-mail  <span class="red">*</span></p>
                    <input class="txtip" name="jform[email]" id="email" value="<?php echo $this->data->email;?>">
                </div> 
            </div><!--col-info-1-->
            <div class="col-info-2">
                <div class="form-marital-stt">
                    <h6>Din civilstatus:</h6>
                    <?php 
                      $civi=explode(";",$this->data->information);
                      $civi1=explode(":",$civi[2]);
                      $civilstatus=$civi1[1];
                    ?>
                    <label class="blradio"><input class="radioip" type="radio" name="jform[civilstatus]" <?php if($civilstatus=="") echo "checked" ?> value="">Single</label>
                    <label class="blradio"><input class="radioip" type="radio" name="jform[civilstatus]" <?php if($civilstatus!="") echo "checked" ?> value="1">Harsammenlevende</label>
                    <p>Har du hjemmeboende børn?</p>
                    <p>Hvis ja, hvor mange og hvillken alder? Hvis ja, hvor mange og hvillken alder?</p>
                    <?php
                    $choicemaker=explode(',', $choicemaker);
                    $choicecount=count($choicemaker);
                    ?>
                    <select class="select-sl" id="choicemaker" name="jform[choicemaker]">
                        <option value="0" <?php if($choicecount==0) echo "selected"?>>Nej</option>
                        <option value="1" <?php if($choicecount==1) echo "selected"?>>1</option>
                        <option value="2" <?php if($choicecount==2) echo "selected"?>>2</option>
                        <option value="3" <?php if($choicecount==3) echo "selected"?>>3</option>
                        <option value="4" <?php if($choicecount==4) echo "selected"?>>4</option>
                    </select>
                    <div id="w-privat">
                        <div class="eachRow clearfix"> 
                            <div id="nam1" class="eachInput divi-col divi-1-2 m-l-0 <?php if($choicecount==0) echo 'class="hide"'?>">
                                <p>Alder på 1. barn (år) </p>
                                <input class="txtip" name="jform[kidage][0]" id="text_nam_1" value="<?php echo $choicemaker[0]?>"> 
                            </div>
                            <div id="nam2" class="eachInput divi-col divi-1-2 <?php if($choicecount<2) echo ' hide'?>">
                                <p>Alder på 2. barn (år)</p>
                                <input class="txtip" name="jform[kidage][1]" id="text_nam_2" value="<?php echo $choicemaker[1]?>"> 
                            </div>  
                        </div>
                        <div class="eachRow clearfix"> 
                            <div  id="nam3" class="eachInput divi-col divi-1-2 m-l-0 <?php if($choicecount<3) echo ' hide'?>">
                                <p>Alder på 3. barn (år) </p>
                                <input class="txtip" name="jform[kidage][2]" id="text_nam_3" value="<?php echo $choicemaker[2]?>"> 
                            </div>
                            <div id="nam4" class="eachInput divi-col divi-1-2 <?php if($choicecount<3) echo ' hide'?>">
                                <p>Alder på 4. barn (år) </p>
                                <input class="txtip" name="jform[kidage][3]" id="text_nam_4" value="<?php echo $choicemaker[3]?>"> 
                            </div>  
                        </div> 
                    </div> 
                </div><!--form-marital-stt-->
                <div class="form-objective-stt">
                    <h6>Delmål:</h6>
                    <p>Hvor mange kg. ønsker du at tabe?</p>
                    <?php 
                    $hvorkg=explode(',',$hvorkg);
                    ?>
                    <div class="eachRow clearfix"> 
                        <div class="eachInput divi-col divi-1-2 m-l-0">
                            <p>1. måned (Kg) </p>
                            <input class="txtip" name="jform[hvorkg][0]" id="hvorkg1" value="<?php echo $hvorkg[0]?>"> 
                        </div>
                        <div class="eachInput divi-col divi-1-2">
                            <p>2. måned (Kg) </p>
                            <input class="txtip" name="jform[hvorkg][1]" id="hvorkg2" value="<?php echo $hvorkg[1]?>"> 
                        </div>  
                    </div>
                    <div class="eachRow clearfix"> 
                        <div class="eachInput divi-col divi-1-2 m-l-0">
                            <p>3. måned (Kg) </p>
                            <input class="txtip" name="jform[hvorkg][2]" id="hvorkg3" value="<?php echo $hvorkg[2]?>"> 
                        </div>
                        <div class="eachInput divi-col divi-1-2">
                            <p>4. måned (Kg) </p>
                            <input class="txtip" name="jform[hvorkg][3]" id="hvorkg4" value="<?php echo $hvorkg[3]?>"> 
                        </div>  
                    </div>
                </div><!--form-objective-stt--> 
            </div><!--col-info-1-->  
        </div><!--wrapCreaterUser-->   
         <div class="wrap-btn-cru clearfix">  
            <a class="btnGreen bntNext right" onclick="check()" style="cursor:pointer;"> Næste <span class="iconext"><img src="templates/fitplan/src_mobile/images/iconNext.png"></span></a> 
        </div>
        <input type="hidden" name="option" value="com_users" />
        <input type="hidden" name="task" value="profile.edit" />
        <input type="hidden" name="user_id" value=<?php echo $user->id?> />
        <?php echo JHtml::_('form.token');?>
    </form>         
    </div><!-- cont-boX-->   
</div>